<template>
  <div id="app">
    <p class="version">v{{ version }}</p>
    <iframe style="height:99%;width:100%" :src="url" frameborder="0"></iframe>
  </div>
</template>

<script>
import { ipcRenderer } from 'electron';
const version = require('../package.json').version;

export default {
  name: 'App',
  data(){
    return{
      version,
      url:process.env.VUE_APP_BASE_URL
    }
  },
  mounted() {

    document.addEventListener('keydown', event => {

      // 检测是否同时按下Ctrl + Shift + I,自动打开开发者模式
      if (event.ctrlKey && event.shiftKey && event.key === 'I') {
        
        // 阻止默认行为
        event.preventDefault();
        // 设置应用的控制台打开/关闭
        ipcRenderer.send('SET_CONSOLE');
      }
    })
    window.addEventListener('message', function (event) {
      if (event.data.action == 'SET_LOGIN_SCREEN') {
        ipcRenderer.send('SET_LOGIN_SCREEN', '');
      }
      if (event.data.action == 'SET_FULL_SCREEN') {
        ipcRenderer.send('SET_FULL_SCREEN', '');
      }
    });
  }
}
</script>

<style>
html,
body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
.version {
  text-align: right;
  margin:0;
  padding:0;
  padding-right:20px;
  font-size: 13px;
}
</style>
